﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace DateService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "DateService" in code, svc and config file together.
    public class DateService : IDateService
    {
        public string GetData(string dateAsString)
        {
            DateTime date = new DateTime();
            DateTime.TryParse(dateAsString,out date);

            if (date == null) 
            {
                throw new ArgumentNullException("Date can`t be null"); 
            }
            switch (date.DayOfWeek) 
            {
                case DayOfWeek.Monday:
                    return "Понеделник";
                case DayOfWeek.Tuesday:
                    return "Вторник";
                case DayOfWeek.Wednesday:
                    return "Сряда";
                case DayOfWeek.Thursday:
                    return "Четвъртък";
                case DayOfWeek.Friday:
                    return "Петък";
                case DayOfWeek.Saturday:
                    return "Събота";
                case DayOfWeek.Sunday:
                    return "Неделя";
                default: throw new ArgumentException("Invalid date");
            }
        }
    }
}
